#include "Util.h"
#include <cstdio>
#include <cstdlib>
#include <cstdarg>

namespace qy
{

void fatal(const char *format, ...)
{
	va_list args;
	va_start(args, format);
	fprintf(stderr, "fatal error occurred: \t");
	vfprintf(stderr, format, args);
	exit(1);
}

void log(LogLevel level, const char *module, const char *format, ...)
{
	va_list args;
	va_start(args, format);
	if(module)
	{
		printf("==%s==\t", module);
	}
	vprintf(format, args);
	printf("\n");
}

std::string &operator+(std::string &str, int i)
{
	char s[20];
	sprintf(s, "%d", i);
	return str.append(s);
}

}
